<?php 
if(isset($form)){
  foreach($form->getFormFieldSchema() as $field){
    if($field->hasError()){
      echo ucfirst($field->getName()).': '.$field->getError()."<br />\n";
    }
  }
}
else{
  if(isset($referer)) $sf_context->getController()->redirect($referer);
}
?>
<a href="javascript:history.back()">Back</a>